﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true"
    CodeBehind="message_edit.aspx.cs" Inherits="LinkCard.AdminCP.Message.message_edit" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 <script type='text/javascript'>
     function locdau(input1, input2) {
         str = document.getElementById(input1).value;
         str = str.toLowerCase();
         str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
         str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
         str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
         str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
         str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");
         str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");
         str = str.replace(/đ/g, "d");
         str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g, "-");
         /* tìm và thay thế các kí tự đặc biệt trong chuỗi sang kí tự - */
         str = str.replace(/-+-/g, "-"); //thay thế 2- thành 1- 
         str = str.replace(/^\-+|\-+$/g, "");
         //cắt bỏ ký tự - ở đầu và cuối chuỗi  
         document.getElementById(input2).value = str;
     }
    </script>
    <script language="javascript">
        function ismaxlengthSend(obj) {
            document.getElementById('soKyTu').value = obj.value.length
            var mlength = 250;
            if (obj.value.length > mlength)
                obj.value = obj.value.substring(0, mlength)

        }
                    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <section id="content">
  <section class="container_12 clearfix">
    <section id="main" class="grid_12">
      <article>
        <div class="h1">Thêm mới bài tin, bài</div>
        
          <dl class="inline">
         
            <dt>
              <label >Danh mục:</label>
            </dt>
            <dd>
              <asp:DropDownList ID="CategoryID" runat="server"></asp:DropDownList>
            </dd>
            <dt>
              <label >Tiêu đề:</label>
            </dt>
            <dd>
              <input type="text"   class="big" id="MsgTitle" runat="server" onKeyUp="return locdau('MsgTitle','MsgSubTitle');" />
              <input type="hidden" name="MsgSubTitle"  
                                id="MsgSubTitle" runat="server">
            </dd>
            
            <dt><label >Trích dẫn (Tối đa 255 ký tự):</label> </dt>
            <dd><textarea name="MsgLead" id="MsgLead" class="big" runat="server"  onKeyUp="return ismaxlengthSend(this);" rows="5"></textarea></dd>
            <dt></dt>
            <dd><input name="soKyTu" id="soKyTu" type="text" style="width: 30px; height: 18px;" /></dd>
             <dt>
              <label >Nội dung:</label>
            </dt>
            <dd>
              <FCKeditorV2:FCKeditor ID="MsgContent" runat="server" BasePath="~/fckeditor/" Height="500px" >
                </FCKeditorV2:FCKeditor>
            </dd>
             <dt>
              <label >Tags:</label>
            </dt>
            <dd>
              <input type="text" class="medium"  id="txtTags" runat="server" /> 
            </dd>
            <dt><label>Ảnh:</label></dt>
            <dd>
            <FCKeditorV2:FCKeditor ID="MsgHomeImage" runat="server" BasePath="~/fckeditor/" Height="500px">
                </FCKeditorV2:FCKeditor>
            </dd>
            <dt><label>Chú thích ảnh:</label></dt>
            <dd><input type="text" name="MsgImageComment" id="MsgImageComment"  class="big" runat="server"></dd>
            <dt>
              <label >Ngày đăng:</label>
            </dt>
            <dd>
              <input type="text"   class="medium" id="MsgPostDate" runat="server" />
            </dd>
           
  
          </dl>
          <p>
          <input type="hidden" id="MessageID" runat="server" />
          <input type="hidden" id="MsgHistory" runat="server" />
          <asp:Button class="button big" style="width:auto;" Text="Lưu" ID="btnAdd" runat="server" 
                  onclick="btnAdd_Click"  />
          </p>
       
      </article>
    </section>
  </section>
</section>
</asp:Content>
